package com.wangsd.web.face.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "advertisement")
@ApiModel(value = "广告管理", description = "广告管理")
public class Advertisement {
    @Id
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "0未上架，1上架")
    @Column(name = "status", columnDefinition = "int(2) default 0 not null")
    private Integer status;

    @ApiModelProperty(value = "是否默认，1，默认，0，非默认")
    @Column(name = "state", columnDefinition = "int(2) default 0 not null")
    private Integer state;

    @ApiModelProperty(value = "服务商id")
    private Long businessId;

    @ApiModelProperty(value = "商户id")
    private Long merchantId;

    @ApiModelProperty(value = "有效开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    @ApiModelProperty(value = "有效结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    @ApiModelProperty(value = "广告名称")
    private String name;

    @ApiModelProperty(value = "类型：0，服务商；1，商户")
    private Integer type;

    @ApiModelProperty(value = "跳转url")
    private String transUrl;

    @ApiModelProperty(value = "图片展示时间")
    private Integer displayTime;

    @ApiModelProperty(value = "数据源类型：0，图片；1，视频")
    private Integer sourceType;

    @ApiModelProperty(value = "展示数据源的路径")
    private String sourceUrl;

    @ApiModelProperty(value = "检索标识")
    private String code;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "广告位 List")
    @Transient
    @TableField(exist = false)
    private List<Advertisement> advertisements;

    @ApiModelProperty(value = "服务商名称")
    @Transient
    @TableField(exist = false)
    private String serviceBusinessName;

    @ApiModelProperty(value = "商户名称")
    @Transient
    @TableField(exist = false)
    private String merchantName;

    @ApiModelProperty(value = "门店list")
    @Transient
    @TableField(exist = false)
    private List<Long> storeIdList;

    @ApiModelProperty(value = "门店id")
    @Transient
    @TableField(exist = false)
    private Long storeId;
}
